Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing /
Chapter 2 - Core Printing Features


Using Core Printing Features

This section shows how to implement the core printing features in your application First, you must determine if QuickDraw GX is installed and, if so, set up its environment. Next, when the user creates a document, your application needs to create a job object for the document and maintain other information about the document. The sample code throughout this book uses a structure, MyDocumentRec, to keep the needed information in one place:

typedef struct MyDocumentRec {
   gxJob       documentJob;      /* the job object bound to the
                                    document */
   long        numPages;         /* the number of pages in the
                                    document */
   long        curPage;          /* the current page */
   FSSpec      documentFSSpec;   /* the file system specification 
                                    for the document */
   Str31       documentTitle     /* the title of the document 
                                    (such as "Untitled") */
   WindowPtr   documentWindow;   /* the window for the document */
   gxViewPort  documentViewPort; /* the view port used for 
                                    drawing within the document
                                    window */
   gxShape     documentPage[kMaxPages];
                                 /* the shape data for each 
                                    page */
   gxFormat    pageFormat[kMaxPages];
                                 /* the format object for each 
                                    page, if nil use the default
                                    format */
} MyDocumentRec, *MyDocumentPtr;
This structure is set up to handle one shape per page. Each page may have its own format, although in this chapter only one format is used. The individual fields in the structure are described as they are used in the following sections.

Your application could define a similar structure, or you could maintain the needed information in variables of your choosing. The variable used in this book is myDocument, which is defined as follows:

MyDocumentRec  myDocument;
The following sections show how to


Subtopics
Initializing QuickDraw GX Printing
Creating a Job Object for a Printable Document
Error Handling
Supporting QuickDraw GX Print Dialog Boxes
Printing Documents Using QuickDraw GX
Saving a Job Object With a Document File
Disposing of a Job Object When Closing a Document
Retrieving a Job Object When Opening a Document
Obtaining Object References
Obtaining Information From a Format Object
Displaying QuickDraw GX Print Dialog Boxes
Supporting Printing From the Finder
Updating Job Object Information
Printing Macintosh Printing Manager Documents

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help